#include "gradedelegate.h"

#include <QLineEdit>

GradeDelegate::GradeDelegate()
{

}

//自定义成绩列委托类，用于成绩的编辑
QWidget *GradeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    if(index.column() == 2) //成绩列
    {
        QLineEdit *editor = new QLineEdit(parent);
        editor->setValidator(new QIntValidator(0, 100, editor));
        return editor;
    }
    return QItemDelegate::createEditor(parent, option, index);
}
